The present invention relates to a video encoding method and apparatus and, more particularly, to a video encoding method and apparatus which are improved to generate video encoded data that allow smooth random access, and facilitate edition by linking encoded data recorded on a recording medium.
According to a basic procedure in MPEG1 or MPEG2, which is an international standard as a video encoding scheme widely used for read-only optical disks such as DVDs, digital broadcasts, and the like, one picture is divided into a plurality of 8xc3x978-pixel blocks, the DCT (discrete cosine transform) is performed for each block, and the resultant DCT coefficients are quantized and variable-length-coded. In addition, this scheme also uses motion compensated predictive inter-frame coding to use the correlation between pictures along the time axis, thereby increasing the encoding efficiency.
The motion compensated predictive inter-frame coding method is an encoding method of sequentially encoding only the predictive error between consecutive frames. In this method, therefore, when encoded data is to be decoded/played back, information of temporally different pictures must be referred to. For this reason, in general, encoded data using motion compensated predictive inter-frame coding makes it difficult to perform random access, e.g., playback from an arbitrary frame of the encoded data, and edition by linking encoded data together at an arbitrary frame.
Under the circumstances, according to the MPEG specifications, to allow random access at a specific frame or edition by linking encoded data together, encoding is performed in units of GOPs (GOP: Group Of Pictures) each consisting of a plurality of frames by setting I-Pictures, which are obtained by intra-coding, at predetermined frame intervals. In addition, the use of a closed GOP, which inhibits inter-frame prediction at a GOP boundary, allows random access and cut and paste operation for edition.
A closed GOP is an independent GOP which does not depend on any pictures of other GOPs, and can be used as an editable point, i.e., a point at which random access from MPEG data is allowed. The number of random access points can be increased by decreasing the number of frames constituting each GOP, and making each GOP become a closed GOP.
If, however, a structure in which the number of frames constituting each GOP is decreased, and each GOP is made to become a closed GOP is used to improve the degree of freedom in random access and edition, an I-Picture, which has a larger number of encoded bits than a P-Picture based on forward prediction and a B-Picture based on bidirectional prediction, appears frequently, resulting in a decrease in encoding efficiency. In general, therefore, there is a trade-off relation between random access/edition manageability and encoding efficiency.
As described above, in MPEG video encoding, if the degree of freedom in random access and cut and past edition is improved by increasing the number of random access points, the encoding efficiency decreases, and the number of encoded bits increases.
It is an object of the present invention to provide a video encoding method and apparatus which allow setting of a random access point at an arbitrary position without any decrease in encoding efficiency, and are suited for random access to encoded data recorded on a recording medium, linking edition of the encoded data, and the like.
According to the present invention, there is provided a video encoding method comprising the steps of, in order to set an intra-coded picture (intra-coded frame) in an encoded picture series (encoded frame series) to a predetermined picture interval (frame interval), and set a random access point, which allows playback from a designated frame, in the encoded picture series, setting an intra-coded picture (intra-coded frame) used for playback from the designated picture (frame) in a picture series in addition to the intra-coded picture (intra-coded frame) inserted in the predetermined picture interval (frame interval), and encoding the intra-coded picture (intra-coded frame) set at the predetermined picture interval (frame interval) and immediately preceding the intra-coded picture (intra-coded frame) set for the random access after switching to motion compensated predictive inter-picture encoding (motion compensated predictive inter-frame coding).
According to this video encoding method, when a random access is to be set at a position different from a cyclic GOP boundary, the cyclic intra-coded frame immediately preceding the random access point is encoded upon switching to the motion compensated predictive inter-frame encoding mode. This can increase the number of frames constituting the GOP immediately preceding the random access point. The encoding efficiency can therefore be increased as compared with the prior art in which the GOP immediately preceding the random access point is terminated at some midpoint, and a GOP having a small number of frames is formed.
The above video encoding method is based on the following principle. In the video encoding method of performing encoding by switching intra-frame encoding and motion compensated predictive inter-frame coding in units of frames, an intra-coded frame is set at a picture series in a predetermined interval. With this operation, encoding is performed while encoded data is divided into encoded frame groups each having a predetermined intra-frame prediction structure. Every time encoding of a currently encoded frame group is complete, it is checked whether a random access point is set to the next frame group. If it is determined that a random access point is set, the inter-frame prediction structure is changed to extend the current encoded frame to the frame immediately preceding the setting position of the random access point.
In this manner, encoding is performed while the inter-frame prediction structure is dynamically changed in accordance with the setting position of a random access. This allows encoding while extending the GOP immediately preceding the random access point and making the random access point coincide with the beginning of a new GOP cycle. This prevents an intra-coded frame from appearing immediately before each random access point in an interval shorter than a normal interval, thereby preventing a decrease in encoding efficiency at each random access point boundary.
In addition, according to the present invention, there is provided a video encoding method comprising the steps of, in order to set an intra-coded frame to the frame series in a predetermined frame interval, and set a random access point which allows playback from a designated frame, set an intra-coded frame used for playback from the designated frame to an encoded frame series in addition to the intra-coded frame set at the predetermined frame interval, and when a first encoded frame, other than a bidirectional prediction encoded frame, temporally located immediately before the intra-coded frame inserted for the random access is an intra-coded frame, encoding the intra-coded frame after switching to motion compensated predictive inter-frame coding.
According to this method, the GOP structure immediately preceding a random access can be properly changed. In addition, in consideration of the difference between the encoding order and the display order, which is based on an inter-frame prediction structure, the GOP structure immediately preceding a random access point can be properly changed without any delay, together with control on random access point setting.
This video encoding method is based on the following basic principle. In the video encoding method of performing encoding by switching intra-frame encoding and motion compensated predictive inter-frame coding in units of frames, encoding is performed while encoded data is divided into encoded frame groups each. having a predetermined inter-frame prediction structure by setting an intra-coded frame to an encoded frame series at a predetermined frame interval. It is checked whether the designation position of a random access point which allows playback from an arbitrary frame is temporally located after an intra-coded frame in a predetermined interval in an encoded frame group immediately preceding the set position. If it is determined that the random access point is designated at a position temporally located after the intra-coded frame in the predetermined interval, the immediately preceding frame group is terminated with the frame immediately preceding the random access point. If it is determined that the random access point is set at a position before the intra-coded frame in the predetermined interval, the immediately preceding encoded frame group is extended to the frame immediately preceding the random access point.
With the application of this principle, the difference between the input order of a video-signal and the encoding order can be used, and prediction structure change control can be performed by checking a random access point boundary and encoded picture type without detecting a random access in the forward direction.
In addition, according to the present invention, the random access point is set by at least one of the following methods: (1) designating the point by using a time code; (2) designating the point by detecting a scene change of input video; and (3) designating the point in read time during encoding.
Method (1) allows accurate, appropriate setting of a random access point in units of frames. In general, a scene change is important as an access unit, and hence method (2) allows automatic, appropriate setting of a random access point in accordance with a scene change. Method (3) allows the user to arbitrarily set an access point in real time while watching video to be encoded.
Furthermore, a recording medium on which data encoded by the present invention is recorded facilitates implementation of random access to a point desired by the user, linking edition of encoded data in units of random access points, and the like without any deterioration in picture quality.
Additional objects and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objects and advantages of the invention may be realized and obtained by means of the instrumentalities and combinations particularly pointed out hereinafter.